package com.rojored.task
{

import org.spicefactory.lib.task.ConcurrentTaskGroup;
import org.spicefactory.lib.task.Task;

//--------------------------------------
//   Other metadata
//--------------------------------------

[DefaultProperty("tasks")]

/**
 *  MXML wrapper for the <code>ConcurrentTaskGroup</code> from the spicelib
 *  Task framework.   Allows for declarative instantiation.
 *
 *  @see http://www.spicefactory.org/parsley/docs/2.4/manual/task.php
 */
public class ConcurrentTaskGroupTag extends ConcurrentTaskGroup
{

    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor
     */
    public function ConcurrentTaskGroupTag()
    {
        super();
    }

    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------

    //--------------------------------------
    //  tasks
    //--------------------------------------

    [ArrayElementType("org.spicefactory.lib.task.Task")]

    /**
     *  List of Tasks to be executed concurrently.
     */
    public function get tasks():Array
    {
        return allTasks.toArray();
    }

    /**
     *  @private
     */
    public function set tasks(value:Array):void
    {
        removeAllTasks();
        for each (var task:Task in value)
            addTask(task)
    }
}
}
